package com.mvc.entity;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName Order
 * @Description TODO
 * @Author Gla
 * @Date 2021/12/1 21:35
 * @Version 1.0
 **/
@Data
@Api("订单详情")
public class Order {
    @ApiModelProperty("主键id")
    private Integer id;
    @ApiModelProperty("实付金额")
    private BigDecimal payment;
    @ApiModelProperty("支付类型")
    private Integer payment_type;
    private Integer status;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date creat_time;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date update_time;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date payment_time;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date consign_time;
    private String shipping_name;
    private String shippingNum;
    @ApiModelProperty("用户id")
    private Integer user_id;
    private String receiver_name;

    private String statu;
    public String getStatu() {
        if (status == 1) {
            return "未付款";
        }else if (status == 2){
            return "已付款";
        }else if (status == 3){
            return "已发货";
        }else if (status == 4){
            return "交易成功";
        }else if (status == 5){
            return "交易关闭";
        }
        return "未知";
    }

    private String type;
    public String getType() {
        if (payment_type == 1) {
            return "在线支付";
        }else if (payment_type == 2){
            return "货到付款";
        }
        return "未知";
    }
}
